package com.leyou.user.client;

import com.leyou.user.dto.AddressDTO;
import com.leyou.user.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @package com.leyou.user.client
 * @description:
 * @author: 许超越
 * @date 2019/7/7 16:59
 * @version: V1.0
 */
@FeignClient("user-service")
public interface UserClient {

    /**
     * 根据用户名和密码查询用户
     * @param username 用户名
     * @param password 密码
     * @return
     */
    @GetMapping("query")
    UserDTO queryUserByUsernameAndPassword(@RequestParam("username") String username, @RequestParam("password") String password);


    /**
     * 查询当前登入用户的所有收件地址
     * @return
     */
    @GetMapping("addressList")
    List<AddressDTO> queryAddress();


    /**
     * 根据用户id和地址id查询查询地址
     * @param id
     * @param userId
     * @return
     */
    @GetMapping("address")
    AddressDTO queryAddressByUserIdAndId(@RequestParam("id") Long id, @RequestParam("userId") Long userId);
}
